<?php
/*
	[Office 515158] (C) 2009-2012 天生创想 Inc.
	$Id: mod_user.php 1209087 2012-01-08 08:58:28Z baiwei.jiang $
*/
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
empty($do) && $do = 'list';
get_union_add();
if ($do == 'list') {
	if ($result = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."user a,".DB_TABLEPRE."user_view b WHERE a.id=b.uid and a.id = '$_USER->id' and a.unionid='".union_id."'")) {
		include_once('template/user.php');
	} else {
		prompt('信息不存在。');
	}
} elseif ($do == 'save') {
	$savetype = getGP('savetype','P');
	$uid = getGP('uid','P','int');
	$user_view = array(
		'number' => check_str(getGP('number','P')),
		'name' => check_str(getGP('name','P')),
		'birthdate' => getGP('birthdate','P'),
		'sex' => getGP('sex','P'),
		'phone' => getGP('phone','P'),
		'tel' => check_str(getGP('tel','P')),
		'fax' => getGP('fax','P','int'),
		'email' => check_str(getGP('email','P')),
		'qq' => check_str(getGP('qq','P')),
		'contact' => check_str(getGP('contact','P')),
		'address' => check_str(getGP('address','P')),
		'unionid' => union_id
	);
	update_db('user_view',$user_view, array('uid'=>$uid));
	show_msg('个人信息更新成功！', 'admin.php?ac='.$ac.'&fileurl='.$fileurl.'');	

} 
?>